<!DOCTYPE html>

<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <meta name="apple-mobile-web-app-title" content="微商城优惠券">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <title>微商城优惠券</title>
    <link type="text/css" rel="stylesheet" href="./source/modules/shopping/ydres/touch.css">
    <script type="text/javascript" src="./source/modules/shopping/ydres/jq.js"></script>
    <script type="text/javascript" src="./source/modules/shopping/ydres/index.js"></script>
    <script type="text/javascript" src="./source/modules/shopping/ydres/zh.js"></script>
    <script type="text/javascript" src="./source/modules/shopping/ydres/jqSelect.js"></script>
     <script type="text/javascript" src="./source/modules/shopping/ydres/jquery.js"></script>
    <style>
        .one1{
            float:left;
            width:49%;
            line-height: 45px;
            text-align: center;
            color: #039eff;
        }
        .sel { background:#2dbe60; color:#fff;}
        .nosel { background:#fff;color:#000}
    </style>
</head>
<body style="zoom: 1;">
<div class="zzblock" style="display:none">
    <div class="alert-box">
        <div class="alertpadding">
            <h1>微商城温馨提示</h1>
            <p id="alertMsg"></p>
        </div>
        <div class="btnaera clearfix">
            <a id="submitBtn" class="one">确定</a>
        </div>
    </div>
</div>

<div class="header">
    <div class="left wleft"><a href="{php echo $this->createMobileUrl('list')}"><img src="./source/modules/shopping/ydres/w_02.png" class="iconheight"></a></div>
    <div class="wcenter">我的优惠券</div>
</div>

<!--优惠券领取-->
<div style="padding-top:50px;">
<div>
    <span class="font14 ie-ltitle" style="padding:0px 0px 0px 20px;">优惠券领取</span>
</div>
<div class="main" style="padding-top:5px;">
<div class="mbg1 mt15" style="position: relative;">
    <div style="float:left;margin-left: 5px;width:80%;margin-top:5px;">
        <input type="text" id="coupon_code" class="minput" style="width:70%;margin-left: 42px;margin-top:-4px;" value="" autocomplete="off" placeholder="请输入优惠券领取码"/>
        <span style="width:10px;height:22px;position:absolute;top:3px;right:16%;" id="closeAdd"><img src="./source/modules/shopping/ydres/error.png" style="width:20px;height:20px;"></span>
    </div>
</div>

<div class="footbtn">
    <div class="foot">
        <div class="t2">
            <div class="ie-t">
                <a class="ok" id="nextBtn" style="background:#009966;">领取优惠券</a>
            </div>
        </div>
    </div>
</div>
<div>
    <form action="{php echo $this->createMobileUrl('couponserver')}" method="post" id="form2">
        <input type="hidden"  id="coupon_codes" name="coupon_code" value="">
        <input name="token" type="hidden" value="{$_W['token']}" />
    </form>
</div>
</div>
</div>
<!--我的优惠券-->
<div style="padding-top:80px;">
<div>
    <span class="font14 ie-ltitle" style="padding:0px 0px 0px 20px;">我的优惠券</span>
</div>
{loop $list $item}
<div class="main" style="padding-top:10px;">
    <div class="detail">
         {if $item['coupon_thumb'] !=''}
        <img src="./resource/attachment/{$item['coupon_thumb']}" border="0px" width="100%" />
        {/if}
        <div class="d2 borderline clearfix">
            名 称：<font color="#999999">{$item['names']}
        </div>
        <div class="d2 borderline clearfix">
         </font>优惠金额：<font color="#999999">{$item['coupon_fee']}</font>
        </div>
        <div class="d2 borderline clearfix">
            领取时间：<font color="#999999">{php echo date('Y-m-d', $item['create_time'])}</font>
        </div>
        <div class="d2 borderline clearfix">
            有效时间：<font color="#999999">{php echo date('Y-m-d', $item['start_time'])} -- {php echo date('Y-m-d', $item['end_time'])}</font>
        </div> 
    </div>
</div>
{/loop}
</div>
<script type="text/javascript">
    $(document).ready(function(){
        $("#nextBtn").on('click',function(){
            var coupon_code=$.trim($('#coupon_code').val());
            if(coupon_code=='' || coupon_code=='请输入优惠券领取码'){
                $('.zzblock').css('display','block');
                $('#alertMsg').html('请输入优惠券领取码<br/><br/>');
                return false;
            }
            //异步拉取优惠券领取码检查是否存在
            var url = "{php echo $this->createMobileUrl('couponserver')}";
            $.ajax({
                url:url,
                type:'POST',
                data:'',
                dataType:'json',
                cache:false,
                success:function(data)
                {
                    if(data.status==1){
                        $('.zzblock').css('display','block');
                        $('#alertMsg').html('输入的优惠券领取码不存在,请重新输入<br/><br/>');
                        return false;
                    }
                }
            });
            $('#coupon_codes').val($.trim($('#coupon_code').val()) );
            $('#form2').submit();
        });
        $('#submitBtn').click(function(){
            $('.zzblock').css('display','none');
            return false;
        });
        $('#closeAdd').click(function(){
            $('#coupon_code').val('');
        });
    });
</script>
</body>
</html>